package cate.common.table.item;

import cate.common.annotation.SplitParse;
import cate.common.util.SplitParser;
import cate.common.util.random.RWItem;
import cate.common.util.random.RWList;

import java.util.List;

/** 命格属性类型 */
public class AttrTypeList extends RWList<AttrTypeList.Item> {

    public void parse(String config) {
        List<Item> l = SplitParser.parse(Item.class, config);
        this.setup(l);
    }

    public static class Item implements RWItem {

        @SplitParse(order = 0, note = "类型")
        public int type;

        @SplitParse(order = 1, note = "权重", defaultValue = "1.0")
        public double weight;

        @Override
        public double getWeight() {
            return weight;
        }
    }
}
